home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / m2 / m2_part1.lha / modula / dice / dice.LHA / doc / BEGINNER_README.DOC < prev    next >
Text File  |  1991-04-15  |  10KB  |  266 lines

  1.  
  2. beginner/help                        beginner/help
  3. beginner/beginner                    beginner/beginner
  4. beginner/beginner_readme                beginner/beginner_readme
  5.  
  6.                BEGINNER'S DOCUMENT FOR DICE
  7.  
  8.     (I)     The C Language
  9.  
  10.     (II)    Your first program, from start to end
  11.  
  12.  
  13.                      (I)
  14.                    THE C LANGUAGE
  15.  
  16.     It is not possible to describe the entirety of the C language in a
  17.     simple document file.  If you have no experience with the C language
  18.     and are trying to learn it the best thing to do is go to your local
  19.     bookstore (that has a computer section hopefully) and buy TWO different
  20.     ANSI C language books.  Really, TWO.  Look for a tutorial style book
  21.     and for a reference style book.  The tutorial style book will have many
  22.     self contained source examples that you can simply type in and run...
  23.     and figure things out by hacking on the examples and seeing the
  24.     results. The reference style book will have a comprehensive description
  25.     of all the standard calls available.  BE SURE YOU GET BOOKS THAT
  26.     DESCRIBE ANSI C rather than the original K&R C.  DICE is nearly 100% an
  27.     ANSI C compiler including nearly all the standard ANSI C functions.
  28.  
  29.     DME, the editor that comes with DICE, has a quick-reference capability
  30.     that allows you to place the cursor over a function name, hit a key, and
  31.     have the manual page for that function brought up in a separate window.
  32.     As you get familiar with DME please try out this function.    The key
  33.     sequence is control-right_bracket from DME.  If you have your own editor
  34.     that is able to generate standard ascii files you may use that in lieu of
  35.     DME.  However, note that DME was designed with programming in mind and
  36.     *does* have that quick-reference capability, and so once learned will
  37.     probably be more efficient for your purposes.
  38.  
  39.                      (II)
  40.              FIRST PROGRAM FROM START TO END
  41.  
  42.     After installing DICE boot your system.  If you run from the workbench
  43.     you must open a CLI or Shell window to fool around with DICE.
  44.  
  45.     NOTE:   From workbench the path might not be properly set up.  If
  46.     you:
  47.  
  48.     1> DCC
  49.  
  50.     and it comes back command not found, and DCC *does* exist on the floppy
  51.     or in-memory, then the path may not be properly set up.
  52.  
  53.  
  54.     (1) Creating the source code.  CD into some scratch directory... I use
  55.     T: here.
  56.  
  57.     1> CD T:
  58.  
  59.     (2) Edit a new file.  You do not have to RUN the editor, but it is always
  60.     nice because you can run the compiler without exiting the editor. This
  61.     tutorial expects you to RUN the editor:
  62.  
  63.     1> RUN DME test.c
  64.  
  65.     (3) DME brings up an editor window on the workbench.  Pressing the
  66.     right mouse button should bring up a menu (assuming you are not
  67.     already familiar with DME and installed it from the DICE disks).
  68.     IF DME DOES NOT HAVE A MENU then the right mouse button will
  69.     probably iconify the window instead.  This means you forgot to
  70.     copy DCC:S/.EDRC into S: ... again, this file already exists if
  71.     you simply booted with a copy of the distribution disk so you should
  72.     see a menu.
  73.  
  74.     Um, that was just to make sure DME is configured right... you can let
  75.     go of the RMB (right mouse button) now.  If you flip through the
  76.     menu items available you will note that many options have keyboard
  77.     equivalents.  For further information on mapping keys to your own
  78.     macros read the DCC2:MAN/DME.DOC document.  You can read the
  79.     document by putting the DCC2: floppy into DF0: and selecting the
  80.     Project/Open-NewWin menu option (this brings up a new window so
  81.     you now have two, though the first one is covered.  To use the
  82.     same window use the Project/Open-Replace menu option).
  83.  
  84.     (4) Type in your program.  The cursor keys may be used to move
  85.     around.  control-cursor_key skips multiple lines while
  86.     shift-cursor_key skips to the top or bottom of the file.
  87.     Typing RETURN on the last line adds a new line to the file.
  88.     Typing RETURN in general inserts a new line after the current
  89.     line.
  90.  
  91.          BASIC DME KEY COMMANDS, REFER TO DCC2:MAN/DME.DOC FOR MORE
  92.          INFORMATION.  These comprise only a few of the many commands
  93.          available.  You can construct your own key macros and menu
  94.          options to your whim as you get better.
  95.  
  96.     <cursor-key>        move the cursor around.
  97.  
  98.     ctl-<cursor-key>    skip around
  99.  
  100.     shift-<cursor-key>  move to top of text, bottom of text, first column,
  101.                 or end-of-line
  102.  
  103.     <del>            delete a character.  Experiment with <del> and
  104.                 <backspace> to determine the differences between
  105.                 the two.
  106.  
  107.     shift-<del>        delete a LINE
  108.  
  109.     ctl-i            control-i, go into insert mode
  110.     ctl-o            control-o, go into overwrite mode
  111.  
  112.     alt-i            ICONIFY WINDOW.  Window becomes iconified (very,
  113.                 very small)... unclutters the workbench screen.
  114.                 You may uniconify by selecting the iconified
  115.                 window and hitting the right mouse button.
  116.  
  117.     help            brings up a new window (as in <f3>) with
  118.                 DCC2:MAN/DME.DOC in it.
  119.  
  120.  
  121.                 FILE LOAD, SAVE
  122.         All of these have equivalent Menu options
  123.  
  124.     <f1>            Insert a file.  The current filename and file
  125.                 in the window stays, but some other file is
  126.                 inserted into the current text... experiment
  127.                 with this with a few small text files.
  128.  
  129.     <f2>            Edit a new file... replaces the current window
  130.                 with a new file.  The old file is gone (not
  131.                 deleted, just not being edited any more).  If
  132.                 you made modifications to the current file a
  133.                 requester will pop up asking you if you want
  134.                 to really throw it away.
  135.  
  136.     <f3>            Edit a new file... opens up a new window for the
  137.                 new file after you type in the file name, the
  138.                 previous file window is still there though
  139.                 probably obscured... you can move and resize
  140.                 the windows however you wish.
  141.  
  142.     <f9>            save file
  143.  
  144.     <f10>            save file and close window (exits DME if this is
  145.                 the last window)
  146.  
  147.     c-q            Quit - same as the close window gadget.
  148.  
  149.  
  150.     (4A)    PROGRAM?  What Program?  This program:
  151.  
  152.     -------- top of file (this line not part of file) --------
  153.  
  154.     #include <stdio.h>
  155.     #include <stdlib.h>
  156.  
  157.     main()
  158.     {
  159.         puts("Hello World!");
  160.         return(0);
  161.     }
  162.  
  163.     -------- bottom of file (this line not part of file) -----
  164.  
  165.     (5) COMPILING THE PROGRAM
  166.  
  167.     Write out the file with F9
  168.  
  169.     You can either quit out of the editor or simply bring your CLI
  170.     window forward to compile the program.    Better, iconify the editor
  171.     window to unclutter your workbench screen!  To compile the program,
  172.     enter this line:
  173.  
  174.     1> dcc test.c -o test
  175.  
  176.     This tells DICE to compile and link test.c into an executable.    DICE
  177.     should grind on the file and then return another CLI prompt.  If any
  178.     requester comes up you are missing an assignment or two:
  179.  
  180.     DINCLUDE:    you are missing the DINCLUDE: assignment which
  181.             should be set to DCC:INCLUDE.
  182.  
  183.     DLIB:        you are missing the DLIB: assignment which should
  184.             be set to DCC:DLIB.
  185.  
  186.     "Unable to open dlib:Amigas13.lib or dlib:dlib:amigas13.lib"
  187.  
  188.         Means that you do not have amigas.lib installed in DLIB: ...
  189.         Amigas13.LIB is Amiga.LIB after being put through the LIBTOS
  190.         program and comes with the registered version of DICE.
  191.  
  192.         Double check that you have 'SETENV DCCOPTS -1.3' and that DLIB:
  193.         is assigned and amigas13.lib is in it, as well as other DICE
  194.         libraries.
  195.  
  196.     (6) RUN THE PROGRAM
  197.  
  198.     1> test
  199.     Hello World!
  200.     1>
  201.  
  202.     You can make the program residentable by compiling with the -r
  203.     option. A -r compiled program's executable will have the PURE bit
  204.     set automatically and may optionally be made resident.    Programs
  205.     not compiled with the -r option will not have the Pure bit set and
  206.     may not be made resident.
  207.  
  208.     1> dcc test.c -o test -r
  209.     1> test
  210.     Hello World!
  211.     1> resident test
  212.     1> test
  213.     Hello World!                <- much faster response!
  214.  
  215.     (7) ***** WARNING ***** ABOUT RESIDENTED EXECUTABLES
  216.  
  217.     It is a COMMON mistake when a programmer is making modifications
  218.     and recompiling a program to forget to REMOVE the program from
  219.     the resident list if it was placed on it.  I.E.
  220.  
  221.     1> resident test REMOVE
  222.  
  223.     The reason is simple... you make a change and recompile your
  224.     program.  But, you have already been the program resident. If you
  225.     run the program the 'old' version will be run.  Thus, you want to
  226.     either remove it from the resident list or re-resident the
  227.     executable.
  228.  
  229.     You can also force a program to be loaded from disk by providing a
  230.     full path to it.  I.E.
  231.  
  232.     1> resident test
  233.     1> test
  234.     Hello World!        <- uses resident version
  235.  
  236.     1> DF0:test        (or wherever you compiled test to)
  237.     Hello World!        <- uses disk version
  238.  
  239.  
  240.     (8)     PROGRAM EXAMPLES
  241.  
  242.     The registered DICE distribution comes with a large number of program
  243.     examples that should prove invaluable to a beginner.  Additionally,
  244.     every manual page includes a self-contained program example for
  245.     the particular function the page describes and this also should
  246.     prove invaluable when confusion arises.
  247.  
  248.     Please refer to the README for an overview, and also browse the
  249.     DICE disks from a CLI.    Unfortunately, due to space packing I
  250.     sometimes move things around and forget to update the
  251.     documentation.    The DME example is the best of the lot and is
  252.     on DCC3:, readme the README file on DCC3 for unpacking instructions.
  253.  
  254.     To run a DMakefile type the DMAKE command on the directory
  255.     containing the DMakefile.  I'm afraid the DMake is a huge
  256.     hack and not much good documentation is available for it, but
  257.     what documentation there is is in DCC3:MAN/DMAKE.DOC
  258.  
  259.     (9)
  260.     That terminates the tutorial.  Refer to the DCC:DOC and DCC2:MAN
  261.     directories for documents describing other executables (use DME
  262.     to bring these files up and browse through them).  Note that the
  263.     top few lines of each file contain a keyword that gives DME it's
  264.     quick-reference capability to the file.
  265.  
  266.